
function useForm (request:{
  updateApi?:(params: any) => Promise<any>
  insertApi?:(params: any) => Promise<any>
}){

  const onRequest = async <T extends {id?:string}>(params:T) => params.id ? request.updateApi(params) : request.insertApi(params)

  return {
    onRequest
  }
}

export default useForm